$(function(){
	var data={
		
	}
	function loadajax(type,php_url,datas,fn){  //封装ajax
		$.ajax({
			type:type,      
			url:php_url,    
			async:true,     
			data:datas,     
			dataType:'json', 
			success:function(msg){
				if(fn){
					fn(msg);
				}
			},error:function(msg){
				alert('ajax连接失败！');
			}
		});
	}
	//	主页轮播图
	
	function banners(msg){
		var html='';
		var oLi = '';
		for(var i = 0 ; i < msg.length ;i++){
					if(i == 0){
						oLi += '<li class="active" data-slide-to="'+i+'" data-target="#carousel-135899"></li>';
						html += '<div class="item active"><img alt="" src="'+msg[i]['banner_src'] +'"/></div>';
					}else{
						oLi += '<li data-slide-to="'+i+'" data-target="#carousel-135899"></li>';
						html += '<div class="item"><img alt="" src="'+msg[i]['banner_src'] +'"/></div>';
					}
				}
				$('.carousel-indicators').html(oLi);
				$('.carousel-inner').html(html);
	    }
	
	loadajax('post',"index.php?m=home&c=index&a=getBanner",data,banners);	
	})